#include <Resources.h>
#include "IssuesToolBar.h"

namespace Domy {

IssuesToolBar::IssuesToolBar(QWidget *parent)
    : QToolBar(parent),
      m_warning_act(Q_NULLPTR),
      m_error_act(Q_NULLPTR)
{
    this->setIconSize(QSize(16, 16));

    QAction *act = this->addAction(GET_ICON("save"), tr("Export"));
    act->setData(static_cast<int>(IssuesAct_Export));

    act = this->addAction(GET_ICON("msg_clear"), tr("Clear"));
    act->setData(static_cast<int>(IssuesAct_Clear));

    this->addSeparator();

    m_warning_act = this->addAction(GET_ICON("warning"), tr("Warning"));
    m_warning_act->setCheckable(true);
    m_warning_act->setData(static_cast<int>(IssuesAct_Warning));

    QWidget *spacer = new QWidget(this);
    spacer->setFixedWidth(5);
    this->addWidget(spacer);

    m_error_act = this->addAction(GET_ICON("error"), tr("Error"));
    m_error_act->setCheckable(true);
    m_error_act->setData(static_cast<int>(IssuesAct_Error));

    this->addSeparator();
}

IssuesToolBar::~IssuesToolBar()
{

}

void IssuesToolBar::setWaringVisibleActionChecked(bool checked)
{
    m_warning_act->setChecked(checked);
}

void IssuesToolBar::setErrorVisibleActionChecked(bool checked)
{
    m_error_act->setChecked(checked);
}


} // namespace Domy
